package Server;

import Bean.User;
import dao.UserCheck;

import java.sql.SQLException;

public class Userservletimpl implements Userservlet {

  public  boolean Userservletimpl(String name, String psd) throws SQLException {
    UserCheck uc=new UserCheck();
    User user =uc.selectUserByUsernameAndPasswod(name, psd);

    if (user==null) {
      return false;

    }
   return true;
  }
  public boolean insertUserservletimpl(String name, String psd) throws SQLException {
    UserCheck uc=new UserCheck();
    Boolean aBoolean =uc.selecttUser(name, psd);
    //aBoolean为rue执行插入语句，否则插入失败
    if (aBoolean) {
       Boolean i=uc.insertUser(name,psd);
       //i插入成功返回true 否则返回flase
       if (i){
         return true;
       }else {
         return false;
       }

    }else {
        return false;
    }

  }



}
